<template>
	<view class="home">
		<view class="" v-if="!type">
			<ty-tab-around :list="tabsList" :list-key="listKey" :active.sync="tabsIndex" @click="changeTabs"
				lineColor='#111111' lineWidth='345'>
			</ty-tab-around>
		</view>
		<view class="padding-top-40">
			<image :src="item.image_url" mode="" class="activeimg" v-for="(item,index) in list" :key="index"
				@click="go('/pages/board/activdetail?id='+item.id)"></image>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				tabsList: ['全部', '已报名'],
				tabsIndex: 0,
				// 显示key
				listKey: '',
				list: [],
				type: ""
			}
		},
		onLoad(options) {
			this.type = options.type ? options.type : ''
			if (this.type) {
				this.tabsIndex = 1
				uni.setNavigationBarTitle({
					title: '我报名的活动'
				});
			}
		},
		onReady() {
			this.loadList(1)
		},
		methods: {
			changeTabs(e) {
				this.tabsIndex = e.index
				// if (e.index == 1) {
				this.loadList(1)
				// }
			},
			loadList(isFirstPage) {
				var that = this
				that.rq.getList('activitie/activitie_list', {
					type: this.tabsIndex,
					shop_id: uni.getStorageSync('store_id'),
				}, {
					that: that,
					first_page: isFirstPage
				})
			},
		},
		onReachBottom() {
			this.loadList(0)
		}
	}
</script>

<style>
	.home {
		width: 100%;
		min-height: 100vh;
		padding: 0 30rpx 0;
		background: #fff;
	}

	.activeimg {
		width: 100%;
		height: 292rpx;
		border-radius: 40rpx 40rpx 40rpx 40rpx;
		margin-bottom: 40rpx;
	}
</style>